package com.yehangtech.designpattern.创建型_抽象工厂;

import com.yehangtech.designpattern.创建型_抽象工厂.adpater.GoodsAdapter;
import com.yehangtech.designpattern.创建型_抽象工厂.adpater.JDKProxyFactory;
import com.yehangtech.designpattern.创建型_抽象工厂.cache.GoodsCache;
import com.yehangtech.designpattern.创建型_抽象工厂.service.ICacheService;
import com.yehangtech.designpattern.创建型_抽象工厂.service.ICacheServiceImpl;

public class Main {
    public static void main(String[] args) {
        // todo: 好好体会这句为什么要返回接口，而不是实现类
        ICacheService cacheService = JDKProxyFactory.getProxy(ICacheServiceImpl.class, new GoodsAdapter());

        System.out.println(GoodsCache.getGoods("1"));

        cacheService.set("1", "nihao");

        System.out.println(cacheService.get("1"));

        System.out.println(GoodsCache.getGoods("1"));

    }
}
